﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DrDimsLib.CoreSDK.Functionality
{
    public enum IOType
    {
        isFile, isDir, UnINIT,
    }
    // 文件信息 数据结构 分装常用的信息 1.文件字节大小 2.文件全路径
    public struct StreamInfo
    {
        //暴露变量 文件全路径
        public int byteLength { get; set; }
        public FileInfo hook { get; set; }
        public IOType IoCate { get; set; }

        public StreamInfo(string fPath)
        {
            byteLength = -1;
            IoCate = IOType.UnINIT;
            hook = new FileInfo(fPath);
            if (File.Exists(fPath))
            {
                byteLength = Convert.ToInt32(hook.Length);
                IoCate = IOType.isFile;
            }
            if (Directory.Exists(fPath))
            {
                var dir = new DirectoryInfo(fPath);
                byteLength = dir.GetFiles().Count();
                IoCate = IOType.isDir;
            }
        }
    }
}
